package com.shuany.ws.jaxb;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

@XmlRootElement(name="TestPerson", namespace="http://www.shuanys.com")
@XmlAccessorType(XmlAccessType.PROPERTY)
public class Person {

    private String firstName;
    private String lastName;
    private int age;
    private boolean isChina;
    private String sex;
    private double height;
    
    //如果属性没有get/set,需采用XlmElement,jaxb才会将其转换,否则不转换
    @XmlElement
    private int something;
    
    //如果是接口需要要xmljavatypeAdapter进行转换
    
    private Address address;
    
    @XmlJavaTypeAdapter(AddressAdapter.class)
    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public Person() {
        
    }

    public Person(String firstName, String lastName, int age, boolean isChina, String sex, double height) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.age = age;
        this.isChina = isChina;
        this.sex = sex;
        this.height = height;
    }
    
    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean isChina() {
        return isChina;
    }

    public void setChina(boolean isChina) {
        this.isChina = isChina;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

}
